import { defaultRequest } from '@shared/utils/request/default-request';
import { ContentTypeEnum } from '@/shared/utils/http/axios';
import {
  productHandleReq,
  productHandleRes,
  createDraftReq,
  createDraftRes,
  creativeMoFangReq,
  creativeMoFangRes
} from './type';

export function productHandleApi(data: productHandleReq) {
  return defaultRequest.post<productHandleRes>({
    url: '/api/product/handle',
    data
  });
}

export function createDraftApi(data: createDraftReq) {
  return defaultRequest.post<createDraftRes>({
    url: '/api/draft/generatev2',
    data
  });
}

export function creativeMoFangApi(data: creativeMoFangReq) {
  return defaultRequest.post<creativeMoFangRes>({
    url: '/api/draft/segments',
    data,
    headers: {
      'Content-type': ContentTypeEnum.FORM_DATA
    }
  });
}

export function productSellcopyRefreshApi(data: { product_id: number }) {
  return defaultRequest.post<boolean>({
    url: '/api/product/sellcopy/refresh',
    data
  });
}
